/*
 * Copyright 2018 The JA-SIG Collaborative. All rights reserved.
 * distributed with thi file and available online at
 */
package com.lap.codegen.core.impl;

import com.lap.codegen.core.DbManager;
import com.lap.codegen.dal.DbDAO;
import com.lap.codegen.domain.DbConf;
import com.lap.codegen.domain.Table;
import com.lap.codegen.exception.ManagerException;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 劳水生 , 021(poker0325@me.com)
 * @version 1.0.0
 */
@Service("dbManager")
@AllArgsConstructor
public class DefaultDbManager implements DbManager {

    private final DbDAO dbDAO;

    @Override
    public List<Table> queryGeneral(DbConf conf) throws ManagerException {
        try {
            return dbDAO.queryGeneral(conf);
        } catch (Exception e) {
            throw new ManagerException(e);
        }
    }

    @Override
    public List<Table> queryByTableName(DbConf conf, List<String> tableNames) throws ManagerException {
        try {
            return dbDAO.queryByTableName(conf, tableNames);
        } catch (Exception e) {
            throw new ManagerException(e);
        }
    }

}
